import menuModel from '@M/menu'

export default {
  init(Vue) {
    Vue.directive("auth",(el,binding) => {
        if(menuModel.authCache){
          if(menuModel.authCache.indexOf(binding.value) != -1){
            return;
          }
        }
        // if(el.className.indexOf("xy-auth") == -1){
        //   el.className = el.className + " xy-auth";
        // }
        if(el.className.indexOf("is-disabled") == -1){
          el.className = el.className + " is-disabled";
        }
        el.setAttribute("xy-auth-code",binding.value);
        el.setAttribute("disabled","disabled");
        el.setAttribute("auth-title",el.getAttribute("title") || '');
        el.setAttribute("title","没有此功能权限");
    });
  }
}